lr16 2.2.0
Loading...
Searching...
No Matches
main.c File Reference

LR 16 Click Example. More...

#include "board.h"
#include "log.h"
#include "lr16.h"
#include "conversions.h"
#include "generic_pointer.h"

Macros

#define DEMO_TEXT_MESSAGE   "MIKROE - LR 16 Click board"
#define APP_BUFFER_SIZE   600
#define PROCESS_BUFFER_SIZE   200
#define READ_RESPONSE_TIMEOUT_MS   60000
#define OPERATING_MODE_P2P   "1"
#define P2P_RX_ENABLE   "1"

Enumerations

enum  lr16_app_state_t { LR16_POWER_UP = 1 , LR16_CONFIG_EXAMPLE , LR16_EXAMPLE }
 Example states. More...

Functions

void application_init (void)
void application_task (void)
int main (void)

Detailed Description

LR 16 Click Example.

Description

This example demonstrates the use of LR 16 Click board by showing the communication between two Click boards configured in P2P network mode.

The demo application is composed of two sections :

Application Init

Initializes the driver and logger.

Application Task

Application task is split in few stages:

  • LR16_POWER_UP: Powers up the device, performs a device factory reset and reads system information.
  • LR16_CONFIG_EXAMPLE: Configures device for the LoRa P2P network mode.
  • LR16_EXAMPLE: Performs a LoRa P2P example by exchanging messages with another LR 16 Click board.

Additional Function

  • static void lr16_clear_app_buf ( void )
  • static void lr16_log_app_buf ( void )
  • static err_t lr16_process ( lr16_t *ctx )
  • static err_t lr16_read_response ( lr16_t *ctx, uint8_t *rsp )
  • static err_t lr16_power_up ( lr16_t *ctx )
  • static err_t lr16_config_example ( lr16_t *ctx )
  • static err_t lr16_example ( lr16_t *ctx )
Author
Stefan Filipovic

Macro Definition Documentation

◆ APP_BUFFER_SIZE

#define APP_BUFFER_SIZE   600

◆ DEMO_TEXT_MESSAGE

#define DEMO_TEXT_MESSAGE   "MIKROE - LR 16 Click board"

◆ OPERATING_MODE_P2P

#define OPERATING_MODE_P2P   "1"

◆ P2P_RX_ENABLE

#define P2P_RX_ENABLE   "1"

◆ PROCESS_BUFFER_SIZE

#define PROCESS_BUFFER_SIZE   200

◆ READ_RESPONSE_TIMEOUT_MS

#define READ_RESPONSE_TIMEOUT_MS   60000

Enumeration Type Documentation

◆ lr16_app_state_t

Example states.

Predefined enum values for application example state.

Enumerator
LR16_POWER_UP 
LR16_CONFIG_EXAMPLE 
LR16_EXAMPLE 

Function Documentation

◆ application_init()

void application_init ( void )

< Logger config object.

< Click config object.

Logger initialization. Default baud rate: 115200 Default log level: LOG_LEVEL_DEBUG

Note
If USB_UART_RX and USB_UART_TX are defined as HAL_PIN_NC, you will need to define them manually for log to work. See LOG_MAP_USB_UART macro definition for detailed explanation.

◆ application_task()

void application_task ( void )

◆ main()

int main ( void )